function AutoScroll(obj) {
    $(obj).find("ul:first").animate({
            marginTop: "-0.8rem"
        },
        1000,
        function() {
            $(this).css({
                marginTop: "0px"
            }).find("li:first").appendTo(this);
        });
}
function replaceNum(num){
    var len = num.length;
    var middleNum = num.substring(3,len-4);
    var result = num.replace(middleNum,'****');
    return result;
}
$(document).ready(function() {
    setInterval('AutoScroll("#notice")', 2000);
    var rate = document.getElementsByClassName("invest-item-rate");
    var rateDate = [];
    for(var i=0;i<rate.length;i++){
        var rateItem = rate[i].innerText;
        rateDate.push(rateItem);
    }
    var progressBarChild = document.getElementsByClassName("invest-item-progressBar-child");
    for(var j=0;j<progressBarChild.length;j++){
        progressBarChild[j].style.width = rateDate[j];
    }
    $('#user-name').text(replaceNum($('#user-name').text()));


    //密码修改页 清除输入的内容
    var clearBtn = $(".pwd-reset-box li span");
    clearBtn.on("click",function () {
        var _this = $(this).parent().index();
        $(".pwd-reset-box li").eq(_this).find("input").val("");
    })
    //返回上一级
    $(".back").on("click",function () {
        window.history.go(-1);
    })



    // my-card page
    var cardNum = [];
    $(".card-num").each(function (index,val) {
        var lastFourNum = $(this).text().substr(length-4,4);
        cardNum.push(lastFourNum);
    })
    var cardNumText = document.getElementsByClassName("card-num");
    for(var i=0 ;i<cardNum.length;i++){
        cardNumText[i].innerText = "**** **** **** "+cardNum[i];
    }
});